package com.woniuxy.commons.service;

import com.woniuxy.commons.entity.Goods;
import com.woniuxy.commons.service.factory.FeignGoodsServiceFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * feign接口
 */

@FeignClient(value = "GOODS",fallbackFactory = FeignGoodsServiceFactory.class)  // 微服务的名字
public interface FeignGoodsService {
    @GetMapping("/goods/all")
    public List<Goods> all();

    @GetMapping("/goods/find/{id}")
    public Goods find(@PathVariable("id") int id);

    @PostMapping("/goods/add")
    public boolean add(@RequestBody Goods goods);

    @PutMapping("/goods/update")
    public boolean update(@RequestBody Goods goods);

    @DeleteMapping("/goods/del/{id}")
    public void del(@PathVariable("id") int id);
}
